<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>书籍列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入 Bootstrap -->
    <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="${pageContext.request.contextPath}./css/admin.css">
    <style>
        #left{
            font-size: large;
            border-width:1px;
            border-style: solid;
            border-color:lightskyblue;
        }
    </style>
</head>
<body>
<nav class="navbar navbar-default">
    <div class="navigation">
        <ul class="nav nav-pills">
            <li role="presentation" class="active"><a href="#">Home</a></li>
            <li role="presentation"><a href="#">Profile</a></li>
            <li role="presentation"><a href="#">Messages</a></li>
            <ul class="nav navbar-nav navbar-right">
                <li role="presentation"><a href="${pageContext.request.contextPath}/book/jumplogin" class="nav-item">登录</a></li>
                <li><a href="#" class="nav-item">注册</a></li>
            </ul>
        </ul>
    </div>
</nav>
<ul class="nav nav-pills nav-stacked col-md-2" id="left">
    <li role="presentation"><a href="#">Home</a></li>
    <li role="presentation"><a href="#">Profile</a></li>
    <li role="presentation"><a href="#">Messages</a></li>
</ul>

<div class="panel panel-info col-md-10">
    <div class="panel-heading">
        <div class="row clearfix">
            <div class="col-md-10 column">
                <div class="page-header">
                    <h2 class="col-md-5" id="shuji">
                        <small>书籍列表 —— 显示所有书籍</small>
                    </h2>
                    <div class="col-md-5 column">
                         <form action="${pageContext.request.contextPath}/book/selectBookByName" class="form-inline" style="float: right">
                            <input type="text" name="bookName" placeholder="search" class="form-control">
                             <input type="submit" value="submit" class="btn btn-primary">
                         </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="panel-body">
        <div class="container">
            <div class="row">
                <div class="col-md-4 column">
                    <a class="btn btn-primary" href="${pageContext.request.contextPath}/book/toaddPage">新增</a>
                </div>
            </div>

            <div class="row clearfix">
                <div class="col-md-10 column">
                    <table class="table table-hover table-striped">
                        <thead>
                        <tr>
                            <th>书籍编号</th>
                            <th>书籍名字</th>
                            <th>书籍数量</th>
                            <th>书籍详情</th>
                            <th>操作</th>
                        </tr>
                        </thead>

                        <tbody>
                        <c:forEach var="book" items="${requestScope.get('list')}">
                            <tr>
                                <td>${book.getBookID()}</td>
                                <td>${book.getBookName()}</td>
                                <td>${book.getBookCounts()}</td>
                                <td>${book.getDetail()}</td>
                                <td>
                                    <a href="${pageContext.request.contextPath}/book/toupdatePage?id=${book.getBookID()}">更改</a> |
                                    <a href="${pageContext.request.contextPath}/book/del/${book.getBookID()}">删除</a>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                    <span style="color: red;font-weight: bold;margin: 100px auto;text-align: center" >${error}</span>
                </div>
            </div>
        </div>
        <nav aria-label="Page navigation" class="navbar-right">
            <ul class="pagination">
                <li>
                    <a href="#" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>
                <li><a href="${pageContext.request.contextPath}/book/allBook">1</a></li>
                <li><a href="#">2</a></li>
                <li><a href="#">3</a></li>
                <li><a href="#">4</a></li>
                <li><a href="#">5</a></li>
                <li>
                    <a href="#" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
            </ul>
        </nav>
    </div>
</div>
</body>